package com.hjm.project.message.message.service.impl;

import java.util.List;

import com.hjm.common.utils.DateUtils;
import com.hjm.common.utils.security.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hjm.project.message.message.mapper.MessgaeInfoMapper;
import com.hjm.project.message.message.domain.MessgaeInfo;
import com.hjm.project.message.message.service.IMessgaeInfoService;
import com.hjm.common.utils.text.Convert;

/**
 * 消息列Service业务层处理
 * 
 * @author LOVE
 * @date 2020-11-26
 */
@Service
public class MessgaeInfoServiceImpl implements IMessgaeInfoService 
{
    @Autowired
    private MessgaeInfoMapper messgaeInfoMapper;

    /**
     * 查询消息列
     * 
     * @param id 消息列ID
     * @return 消息列
     */
    @Override
    public MessgaeInfo selectMessgaeInfoById(Long id)
    {
        return messgaeInfoMapper.selectMessgaeInfoById(id);
    }

    /**
     * 查询消息列列表
     * 
     * @param messgaeInfo 消息列
     * @return 消息列
     */
    @Override
    public List<MessgaeInfo> selectMessgaeInfoList(MessgaeInfo messgaeInfo)
    {
        return messgaeInfoMapper.selectMessgaeInfoList(messgaeInfo);
    }

    /**
     * 新增消息列
     * 
     * @param messgaeInfo 消息列
     * @return 结果
     */
    @Override
    public int insertMessgaeInfo(MessgaeInfo messgaeInfo)
    {
        messgaeInfo.setCreate_time(DateUtils.getDateTime());
        messgaeInfo.setAddUserId(ShiroUtils.getSysUser().getObjNo());
        messgaeInfo.setAddName(ShiroUtils.getSysUser().getLoginName());
        return messgaeInfoMapper.insertMessgaeInfo(messgaeInfo);
    }

    /**
     * 修改消息列
     * 
     * @param messgaeInfo 消息列
     * @return 结果
     */
    @Override
    public int updateMessgaeInfo(MessgaeInfo messgaeInfo)
    {
        messgaeInfo.setUpdate_time(DateUtils.getDateTime());
        messgaeInfo.setAddUserId(ShiroUtils.getSysUser().getObjNo());
        messgaeInfo.setAddName(ShiroUtils.getSysUser().getLoginName());
        return messgaeInfoMapper.updateMessgaeInfo(messgaeInfo);
    }

    /**
     * 删除消息列对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMessgaeInfoByIds(String ids)
    {
        return messgaeInfoMapper.deleteMessgaeInfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除消息列信息
     * 
     * @param id 消息列ID
     * @return 结果
     */
    @Override
    public int deleteMessgaeInfoById(Long id)
    {
        return messgaeInfoMapper.deleteMessgaeInfoById(id);
    }
}
